package cn.hp.controller;

import cn.hp.entity.LoginInfor;
import cn.hp.service.LoginInforService;
import cn.hp.util.Result;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/loginInfor")
public class LoginInforController {
    @Autowired
    private LoginInforService loginInforService;

    @RequestMapping("/find")
    public Result find(LoginInfor loginInfor){
        List<LoginInfor> loginInforList = loginInforService.findLoginInfor(loginInfor);
        return Result.success(loginInforList);
    }

    @RequestMapping("/page")
    public Result page(LoginInfor loginInfor, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "limit") Integer limit){
        PageInfo<LoginInfor> loginInforPage = loginInforService.findLoginInfor(loginInfor,page,limit);
        return Result.success(loginInforPage);
    }
}
